package com.cncytech.uiautomator_demo;

import org.junit.runner.notification.RunNotifier;
import org.junit.runners.model.InitializationError;
import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
import org.junit.runners.parameterized.TestWithParameters;

/**
 * 添加运行监听器的同事  可以使用参数化
 */
public class IRunnerWithParameters extends BlockJUnit4ClassRunnerWithParameters {
   public static final IListener4Parameters iListener4Parameters = new IListener4Parameters();
    public IRunnerWithParameters(TestWithParameters test) throws InitializationError {
        super(test);
    }



    @Override
    public void run(RunNotifier notifier) {
        // TODO: 2024/2/21  参数化的监听器需要先销毁，再添加否则会一直添加
        notifier.removeListener(iListener4Parameters);
        notifier.addListener(iListener4Parameters);
        super.run(notifier);
    }
}
